package main.java.FSMDE.validation.rules;

import java.util.ArrayList;
import java.util.List;

import main.java.FSMDE.models.Diagram;
import main.java.FSMDE.models.Interface;
import main.java.FSMDE.validation.IValidationEntry;
import main.java.FSMDE.validation.rules.IRulesValidator;


public class InterfaceMustHaveComponentsValidator implements IRulesValidator {

	@Override
	public Iterable<IValidationEntry> validate(Diagram diagram) {
		List<IValidationEntry> entries = new ArrayList<IValidationEntry>();
		
		for (Interface inface : diagram.getInterfaces()) {
			if(inface.getComponents().count() == 0) entries.add(new InterfaceMustHaveComponentsValidationEntry(diagram, inface) );
		}
		
		return entries;
	}

}
